Why doesn't the Visual Studio C compiler like this? [migrated]
        Posted  
        
            by 
                justin
            
        on Programmers
        
        See other posts from Programmers
        
            or by justin
        
        
        
        Published on 2011-11-16T03:00:11Z
        Indexed on 
            2011/11/16
            10:23 UTC
        
        
        Read the original article
        Hit count: 463
        
The following code compiles fine on Linux using gcc -std=c99 but gets the following errors on the Visual Studio 2010 C compiler:
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86 Copyright (C) Microsoft Corporation. All rights reserved. fib.c fib.c(42) : error C2057: expected constant expression fib.c(42) : error C2466: cannot allocate an array of constant size 0 fib.c(42) : error C2133: 'num' : unknown size
The user inputs the amount of Fibonacci numbers to generate. I'm curious as to why the Microsoft compiler doesn't like this code.
© Programmers or respective owner